package com.teradyne.merlin2.ui.client.activities;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.teradyne.merlin2.ui.client.places.OrderEntryPlace;
import com.teradyne.merlin2.ui.client.places.OrderHistoryPlace;
import com.teradyne.merlin2.ui.client.places.OrderListPlace;
import com.teradyne.merlin2.ui.client.views.OrderMenuView;

public class OrderMenuActivity extends AbstractActivity implements OrderMenuView.Presenter, ActivityCustom {

	private final OrderMenuView view;
	private final PlaceController placeController;
	private Place place;

	public OrderMenuActivity(OrderMenuView view, PlaceController placeController) {
		this.view = view;
		this.placeController = placeController;
	}

	@Override
	public void start(final AcceptsOneWidget container, final EventBus eventBus) {
		container.setWidget(view.asWidget());
		view.setPresenter(OrderMenuActivity.this);
	}

	@Override
	public void onOrderListClicked() {
		placeController.goTo(new OrderListPlace());		
	}

	@Override
	public void onOrderEntryClicked() {
		placeController.goTo(new OrderEntryPlace());	
	}

	@Override
	public void onOrderHistoryClicked() {
		placeController.goTo(new OrderHistoryPlace());	
	}

	@Override
	public void setPlace(Place place) {
		this.place = place;
	}

	@Override
	public Place getPlace() {
		return place;
	}
	


}